﻿@model List<ECG.Common.ProductCommentListDetailDto>
@if (Model.Any())
{
    var sort = ViewBag.Sort;
    
    <div class="comment-sort">
        <label class="inline" for="CommentsortOrder">Sắp xếp theo</label>
        <select class="CommentsortOrder" onchange="getPaggingComment(1)">
            @{
                if(sort==0)
                {
                    <option selected="selected" value="0">Ngày tạo</option>
                    <option value="1">Đánh giá tốt nhất</option>
                    <option value="2">Nhận xét tệ nhất</option>
                }
                else if (sort == 1)
                {
                    <option value="0">Ngày tạo</option>
                    <option selected="selected" value="1">Đánh giá tốt nhất</option>
                    <option value="2">Nhận xét tệ nhất</option>
                }
                else
                {
                    <option value="0">Ngày tạo</option>
                    <option value="1">Đánh giá tốt nhất</option>
                    <option selected="selected" value="2">Nhận xét tệ nhất</option>
                }
            }
            
        </select>
        <div class="CommentPagging">
            @{
                var currentPage = Convert.ToInt32(ViewBag.CurrentPage);
                for (int i = 1; i <= Convert.ToInt32(ViewBag.TotalPage); i++)
                {
                    if (i == currentPage)
                    {
                        <span>@i</span>
                    }
                    else
                    {
                        <a href="javascript:void(0);" rel="nofollow" onclick="getPaggingComment('@i')">@i</a>
                    }
                }
            }
        </div>
    </div>
    <ul class="ratRev_reviewList ul">
        @foreach (var pc in Model)
        {
            <li class="ratRev_reviewListRow" itemprop="review" itemscope="" itemtype="http://schema.org/Review">
                <div class="ratRev_revTitle" itemprop="name">
                    @Html.Raw(pc.Title)
                </div>

                <div class="ratRev_revDetails">
                    <span class="ratRev-revNickname ratRev_revDetailsItm" itemprop="author">@pc.FullName</span>
                    <meta itemprop="datePublished" content="2013-11-13">
                    <span class="ratRev_revDate ratRev_revDetailsItm">@pc.CreateDate.ToString("dd/MM/yyyy")</span>
                </div>
                <ul class="ratRev_ratOptions ul clearfix">
                    <li class="clearfix">
                        <span class="ratRev-ratOptTitle">Đánh giá</span>
                        @{
                            string StarPercent = "0";
                            if (pc.Star != 0)
                            {
                                StarPercent = (Convert.ToDouble(pc.Star) * 100 / 5).ToString("#.#").Replace(',', '.');
                            }
                        }
                        <span class="itm-ratStars ui-inlineBlock"><span style="width: @StarPercent%;" class="itm-ratStars itm-ratRating"></span></span>
                    </li>
                </ul>
                <div itemprop="reviewRating" itemscope="" itemtype="http://schema.org/Rating">
                    <meta itemprop="worstRating" content="1">
                    <meta itemprop="ratingValue" content="@pc.Star">
                    <meta itemprop="bestRating" content="5">
                </div>

                <div class="ratRev_revDetail" itemprop="description">
                    @Html.Raw(pc.Content)
                </div>
            </li>
        }
    </ul>
}